package uk.ac.glasgow.demosocs.impl.electionmanager;

import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import uk.ac.glasgow.demosocs.Election;

public class ElectionManager {

	private HashMap<String, Election> electionMap;

	public ElectionManager(HashMap<String, Election> electionMap) {
		super();
		this.electionMap = electionMap;
	}
	public ElectionManager() {
		electionMap = new HashMap<String, Election> ();
	}

	public Election getElection(String eid){
		return electionMap.get(eid);
	}
	
	public Set<Election> getElections(){
		return new HashSet<Election>(electionMap.values()); // unsure what type of set we decided on
	}
	
	public Election addElection(String name, String typeID){
		return new ElectionImpl(name, typeID);
	}
	
	/*
	 * I HAVE ADDED Election as a paramter as i think it needs it - Ben Callis 14/2/11
	 * 
	 * openNominations the date from which candidates may be nominated until the election is started.
	 * start the date the election starts and votes may be cast
	 * end the date the election ends and no more votes may be cast.
	 * electoratelectionID the identifier for the group of voters eligible to participate in the election.
	 */
	public void editElection(Election election, Date openNominations, Date start, Date end, String electoratelectionID ){
		election.setOpenNominations(openNominations);
		election.setStart(start);
		election.setEnd(end);
		
		// unusure what to do with electoratelectionID?
	}
	
}
